package com.zhangbo.share.web;

import com.zhangbo.share.dto.ResponseDTO;
import com.zhangbo.share.vo.RequestVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @auth zhangbo on 2022/10/22.
 */
@Slf4j
@Controller
@RequestMapping("/form")
public class FormController {


    /**
     * 测试form post请求
     * @param requestVO
     * @return
     */
    @PostMapping("/post")
    @ResponseBody
    public Object testPost(RequestVO requestVO) {
        log.info("方法接收到入参：{}",requestVO);
        ResponseDTO responseDTO = new ResponseDTO();
        responseDTO.setResultCode(200);
        responseDTO.setResultMsg("成功");

        return responseDTO;
    }


    /**
     * 测试form get请求
     * @param requestVO
     * @return
     */
    @GetMapping("/get")
    @ResponseBody
    public Object testGet(RequestVO requestVO) {
        log.info("方法接收到入参：{}",requestVO);

        ResponseDTO responseDTO = new ResponseDTO();
        responseDTO.setResultCode(200);
        responseDTO.setResultMsg("成功");

        return responseDTO;
    }

}
